<template>
  <div>
    <ul>
      <li v-for="(item,index) in data" :key='index'>
        <router-link :to="`/home/message/detail?id=${item.id}&title=${item.title}`">
        message{{item.id}}
        </router-link>
        <button @click="replaceShow(item)">replace前进</button>
        <button @click="pushShow(item)">push前进</button>
      </li>
    </ul>
    <hr>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name:'Message',
  data() {
    return {
      data:[
        {id:'001',title:'消息1'},
        {id:'002',title:'消息2'},
        {id:'003',title:'消息3'},
      ]
    }
  },
  methods: {
    replaceShow(item) {
      this.$router.replace({
        path:'/home/message/detail',
        query:{
          id:item.id,
          title:item.title
        }
      })
    },
    pushShow(item) {
      this.$router.push({
        path:'/home/message/detail',
        query:{
          id:item.id,
          title:item.title
        }
      })
    }
  },
}
</script>

<style>

</style>